<?php

namespace App\Models\Headquarters;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
 * 总部DCS数据对象
 */
class DcsData extends Model
{
    use HasFactory;
    public $timestamps = FALSE;
    protected $fillable = ['id', 'tag_name', 'value', 'datetime'];

    public function insertOne($params){
        return self::create($params);
    }

    public function insertMany($params){
        return self::insert($params);
    }

    public function findRowBySn($sn){
        return self::where('id', $sn)->first();
    }

    public function findRowByTagAndTime($tag_name, $datetime){
        return self::where('tag_name', $tag_name)->where('datetime', $datetime)->first();
    }
}
